<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>

<!-- ========================= -->
<!-- root element: packingSlip -->
<!-- ========================= -->
<xsl:template match="packingSlip">

	<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <!-- ========================= -->
    <!-- gobal variables           -->
    <!-- ========================= -->
    <xsl:variable name="cancelImagePath" select="images//cancelImage"/>
    <xsl:variable name="logoPath" select="images//logo"/>

  	<fo:layout-master-set>
		<fo:simple-page-master master-name="A4-portrait"
        		page-height="11in"
        		page-width="8.5in"
        		margin-top="20mm"
        		margin-bottom="12mm"
      			margin-left="10mm"
      			margin-right="10mm">

            <fo:region-after extent="5mm"/>

			<!-- ========================================================  -->
			<!-- Inorder to check whether packing slip is cancelled or not -->
			<!-- ========================================================  -->

			<xsl:if test="@cancel='0'">
			<fo:region-body />
			</xsl:if>

			<xsl:if test="@cancel='1'">
			<fo:region-body background-image="{$cancelImagePath}" />
			</xsl:if>

  		</fo:simple-page-master>
	</fo:layout-master-set>


<fo:page-sequence master-reference="A4-portrait">
<!--============================== -->
<!-- Page Number block             -->
<!--============================== -->

<fo:static-content flow-name="xsl-region-after">
	<fo:block font-size="7pt" font-weight="bold" text-align="right">
        Page <fo:page-number />
	<!--
	<xsl:value-of select="count(/packingSlip/lineItems/lineItem)"/>
	-->
	 of
	<fo:page-number-citation ref-id="endofdoc"/>
	<!--
	<fo:page-number-citation ref-id="last-page"/>
	-->
   </fo:block>
</fo:static-content>

<fo:flow flow-name="xsl-region-body">
    <!--==============================-->
    <!-- Logo and Self address block  -->
    <!--==============================-->
	<fo:block font-size="8pt" space-after="1cm">
	<fo:table table-layout="fixed" width="100%" >
    <fo:table-column column-width="35mm"/>
	<fo:table-column column-width="20mm" />
	<fo:table-column display-align="center" />
	<fo:table-column />
	<fo:table-body>
		<fo:table-row>
			<fo:table-cell>
            <fo:external-graphic src="{$logoPath}" content-height = ".5in"  content-width = ".5in" />
	     	</fo:table-cell>
			<fo:table-cell />
            <fo:table-cell text-align="center">
                <fo:block font-size="12pt" font-weight="bold" display-align="center">Packing Slip</fo:block>
            </fo:table-cell>
            <fo:table-cell display-align="right">
                <fo:table table-layout="fixed" width="100%" >
                    <fo:table-column />
                    <fo:table-column display-align="right" />
                    <fo:table-body>
                        <fo:table-row>
                            <fo:table-cell> </fo:table-cell>
                            <fo:table-cell text-align="left">
                                <xsl:apply-template match="selfAddress">
                                    <fo:block font-size="7pt" font-weight="bold"><xsl:value-of select="selfAddress//name" /></fo:block>
                                    <fo:block font-size="7pt" font-weight="bold"><xsl:value-of select="selfAddress//address1" /></fo:block>
                                    <fo:block font-size="7pt" font-weight="bold"><xsl:value-of select="selfAddress//address2" /></fo:block>
                                    <fo:block font-size="7pt" font-weight="bold"><xsl:value-of select="selfAddress//address3" /></fo:block>
                                    <fo:block font-size="7pt" font-weight="bold"><xsl:value-of select="selfAddress//address4" /></fo:block>
                                    <!--<fo:block font-size="7pt" font-weight="bold"><xsl:value-of select="selfAddress//city" /></fo:block>-->
                                    <fo:block font-size="7pt" font-weight="bold"><xsl:value-of select="selfAddress//state" /></fo:block>
                                    <fo:block font-size="7pt" font-weight="bold"><xsl:value-of select="selfAddress//phone" /></fo:block>
                                    <fo:block font-size="7pt" font-weight="bold"><xsl:value-of select="selfAddress//fax" /></fo:block>
                                </xsl:apply-template>
                            </fo:table-cell>
                        </fo:table-row>
                    </fo:table-body>
                </fo:table>
            </fo:table-cell>
        </fo:table-row>
	</fo:table-body>
	</fo:table >
	</fo:block>
    <!--==============================-->
    <!-- From and To addresses block  -->
    <!--==============================-->
	<fo:table table-layout="fixed" width="100%" space-after="1cm">
		<fo:table-column column-width="60mm"/>
		<fo:table-column column-width="60mm"/>
		<fo:table-column column-width="60mm"/>
		<fo:table-body>
			<fo:table-row>
				<fo:table-cell hyphenate="true">
			 		<fo:block font-size="8pt" > <xsl:apply-templates select="shipFromAddress"/> </fo:block>
				</fo:table-cell>
				<fo:table-cell/>
				<fo:table-cell hyphenate="true">
			 		<fo:block font-size="8pt" > <xsl:apply-templates select="shipToAddress"/> </fo:block>
				</fo:table-cell>
			</fo:table-row>
		</fo:table-body>
	</fo:table>
    <!--=============================== -->
    <!-- Shipping Instructions block    -->
    <!--=============================== -->
    <fo:block font-size="8pt" font-weight="bold" space-after="2mm" text-decoration="underline">Shipping Instructions:</fo:block>
    <fo:block font-size="8pt" background-color="#DEE1E2" space-after="1cm" > <xsl:value-of select="ShippingInstructions"/> </fo:block>
    <!--===============================-->
    <!-- Information block             -->
    <!--===============================-->
	<fo:block font-size="8pt">
		<xsl:apply-templates select="information"/>
	</fo:block>

    <xsl:if test="/packingSlip/information/showPackageInformation='true'">
    <fo:block font-size="7pt">
	    <fo:table space-after="1cm" width="100%" table-layout="fixed">
        <xsl:if test="/packingSlip/information/showPackageInformation='true'">
        <fo:table-column column-width="28mm" />
		<fo:table-column column-width="28mm"/>
        <fo:table-column column-width="15mm"/>
        <fo:table-column column-width="15mm"/>
        <fo:table-column column-width="15mm"/>
        <fo:table-column column-width="15mm"/>
        <fo:table-column column-width="15mm"/>
        <fo:table-column column-width="15mm"/>
        <fo:table-column column-width="25mm"/>
		<fo:table-column column-width="25mm"/>
        </xsl:if>
        <xsl:if test="/packingSlip/information/showPackageInformation!='true'">
        <fo:table-column column-width="164mm" />
        </xsl:if>
        <fo:table-body>
            <fo:table-row height="0.5cm" background-color="#DEE1E2">
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">Country of Origin(Fab)</fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">Country of Origin(Assy)</fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">MAWB No</fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">HAWB No</fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">Flight-1 No</fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">Flight-2 No</fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">ETD</fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">ETA</fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">Package Dimension(<xsl:value-of select="/packingSlip/information/uomPackageDimension"/>)</fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">Gross Weight(<xsl:value-of select="/packingSlip/information/weightMeasurement"/>)</fo:block>
                </fo:table-cell>

            </fo:table-row>
            <fo:table-row  height="0.4cm" background-color="#FFFFEE">
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">
                        <xsl:value-of select="/packingSlip/information/countryOfOriginFab"/>
                    </fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">
                        <xsl:value-of select="/packingSlip/information/countryOfOriginAssm"/>
                    </fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">
                        <xsl:value-of select="/packingSlip/information/mawbNo"/>
                    </fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">
                        <xsl:value-of select="/packingSlip/information/hawbNo"/>
                    </fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">
                        <xsl:value-of select="/packingSlip/information/flightNoOne"/>
                    </fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">
                        <xsl:value-of select="/packingSlip/information/flightNoTwo"/>
                    </fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">
                        <xsl:value-of select="/packingSlip/information/etd"/>
                    </fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">
                        <xsl:value-of select="/packingSlip/information/eta"/>
                    </fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">
                        <xsl:value-of select="/packingSlip/information/packageDimension"/>
                    </fo:block>
                </fo:table-cell>
                <fo:table-cell border="1pt double black" display-align="center">
                    <fo:block font-weight="bold" text-align="center">
                        <xsl:value-of select="/packingSlip/information/grossWeight"/>
                    </fo:block>
                </fo:table-cell>
            </fo:table-row>
            </fo:table-body>
        </fo:table>
	</fo:block>
    </xsl:if>
    <!--=============================== -->
    <!-- Comments block ; -->
    <!--=============================== -->
    <fo:block font-size="8pt" font-weight="bold" space-after="2mm" text-decoration="underline">Comments:</fo:block>
    <fo:block font-size="8pt" background-color="#DEE1E2" space-after="1cm" >
        <xsl:value-of select="Comments"/>
    </fo:block>
    <!--=============================== -->
    <!-- Line Items details block      -->
    <!--=============================== -->
	<fo:block font-size="8pt" space-after="1cm">
        <xsl:apply-templates select="lineItems"/>
    </fo:block>
    <!--=============================== -->
    <!-- Footer block                   -->
    <!--=============================== -->
	<fo:table margin="1cm" width="100%" table-layout="fixed">
       <fo:table-column column-width="140mm" />
	       <fo:table-body>
	       <fo:table-row>
	       <fo:table-cell display-align="center">
		       <fo:block text-align="center" font-size="10pt" font-weight="bold" space-after="2mm">
			    CERTIFICATE OF COMPLIANCE
       	       </fo:block>
	       </fo:table-cell>
	       </fo:table-row>
	       <fo:table-row>
	       <fo:table-cell display-align="center">
		       <fo:block text-align="left" font-size="7pt" font-weight="bold" space-after="1mm">
				THIS PRODUCT SHIPPED HERE WITH HAVE BEEN INSPECTED AND COMPLY WITH THE REQUIREMENTS
				OF YOUR PURCHASE ORDER TO THE EXTENT THAT SUCH REQUIREMENTS HAVE BEEN ACCEPTED AND
				ACKNOWLEDGED BY	<xsl:value-of select="selfAddress//cName" /> SUBSTANTIATING INSPECTION AND TEST ON FILE.
         	   </fo:block>
               <fo:block text-align="left" font-size="7pt" font-weight="bold" space-after="0">
				WE CERTIFY THAT INSPECTION EVIDENCE, INCLUDING TEST DATA,NECESSARY TO SUBSTANTIATE THIS CERTIFICATION
                IS AVAILABLE FROM OUR FILES.
               </fo:block>
           </fo:table-cell>
	       </fo:table-row>
	       <fo:table-row>
	       <fo:table-cell display-align="center">
		       <fo:block text-align="center" font-size="7pt" font-weight="bold" space-after="1cm">
				THANK YOU FOR YOUR BUSINESS!
       	       </fo:block>
	       </fo:table-cell>
	       </fo:table-row>
	       </fo:table-body>
	</fo:table>
	<fo:table margin="1cm" width="100%" table-layout="fixed">
	       <fo:table-column column-width="50mm" />
           <fo:table-column column-width="45mm" />
           <fo:table-column column-width="45mm" />
	       <fo:table-body>
	       <fo:table-row>
	       <fo:table-cell display-align="center">
		       <fo:block text-align="left" font-size="7pt" font-weight="bold" space-after="1cm">
				Packed By:
       	       </fo:block>
		       <fo:block text-align="left" font-size="7pt" font-weight="bold" space-after="1cm">
               Checked By:
               </fo:block>
               <fo:block space-after="1cm"></fo:block>
	       </fo:table-cell>
	       <fo:table-cell display-align="center">
		       <!--<fo:block>
		       <fo:leader leader-pattern="rule" leader-length="2.5in" rule-thickness="1pt" color="black" /></fo:block>-->
		       <fo:block border-bottom="1pt dashed black" font-size="6pt">
                   <xsl:value-of select="/packingSlip/information/signature"/>
               </fo:block>
		       <fo:block text-align="left" font-size="6pt" font-weight="bold" space-after="1cm">
			    Name/Signature
         	   </fo:block>
		       <fo:block border-bottom="1pt dashed black" font-size="6pt">
                   <xsl:value-of select="/packingSlip/information/signature"/>
               </fo:block>
		       <fo:block text-align="left" font-size="6pt" font-weight="bold" space-after="1cm">
		       Name/Signature
	           </fo:block>
               <fo:block space-after="1cm"></fo:block>
           </fo:table-cell>
	       </fo:table-row>
               </fo:table-body>
           </fo:table>
            <!-- Inorder to get page count -->
          <fo:block id="endofdoc"></fo:block>
    </fo:flow>
    </fo:page-sequence>
    </fo:root>
</xsl:template>
<!-- ================================ -->
<!--  Child element: Ship From Address  -->
<!-- ================================ -->
<xsl:template match="shipFromAddress">
	<fo:table margin="2mm" width="100%" table-layout="fixed">
		<fo:table-column />
	        <fo:table-body>
			<fo:table-row height="0.5cm">
				<fo:table-cell background-color="#DEE1E2" border="1pt double black" display-align="center">
				<fo:block font-weight="bold">Ship From:</fo:block>
				</fo:table-cell>
			</fo:table-row>

			<fo:table-row height="4cm">
				<fo:table-cell font-weight="bold" background-color="#FFFFEE" border="1pt double black" display-align="top">
				<fo:block space-before="2mm" ><xsl:value-of select="name"/></fo:block>
                <fo:block>
                    <xsl:if test="contactPerson!=''">
                    C/O
                    </xsl:if>
                    <xsl:value-of select="contactPerson"/>
                </fo:block>
                <fo:block><xsl:value-of select="address1"/></fo:block>
				<fo:block><xsl:value-of select="address2"/></fo:block>
				<fo:block><xsl:value-of select="address3"/></fo:block>
				<fo:block><xsl:value-of select="address4"/></fo:block>
				<fo:block><xsl:value-of select="city"/></fo:block>
			    <fo:block><xsl:value-of select="state"/></fo:block>
				<fo:block><xsl:value-of select="phone"/></fo:block>
				<fo:block><xsl:value-of select="fax"/></fo:block>
		        <fo:block><xsl:value-of select="email"/></fo:block>
				</fo:table-cell>
			</fo:table-row>
		</fo:table-body>
	</fo:table>
</xsl:template>

<!-- =================================== -->
<!--	Child element: Ship To Address   -->
<!-- =================================== -->
<xsl:template match="shipToAddress">
	<fo:table margin="2mm" width="100%" table-layout="fixed">
		<fo:table-column />
		<fo:table-body>
			<fo:table-row height="0.5cm">
				<fo:table-cell background-color="#DEE1E2" border="1pt double black" display-align="center">
				<fo:block font-weight="bold">Ship To:</fo:block>
				</fo:table-cell>
			</fo:table-row>
			<fo:table-row height="4cm">
				<fo:table-cell font-weight="bold" background-color="#FFFFEE" border="1pt double black" display-align="top">
				<!--<fo:block space-before="2mm"><xsl:value-of select="name"/></fo:block>-->
				<fo:block space-before="2mm"><xsl:value-of select="address1"/></fo:block>
				<fo:block><xsl:value-of select="contactPerson"/></fo:block>
				<fo:block><xsl:value-of select="address2"/></fo:block>
				<fo:block><xsl:value-of select="address3"/></fo:block>
				<fo:block><xsl:value-of select="address4"/></fo:block>
                <fo:block><xsl:value-of select="city"/></fo:block>
                <fo:block><xsl:value-of select="state"/></fo:block>
				<fo:block><xsl:value-of select="phone"/></fo:block>
				<fo:block><xsl:value-of select="fax"/></fo:block>
                <fo:block><xsl:value-of select="cellno"/></fo:block>
                <fo:block><xsl:value-of select="email"/></fo:block>
				</fo:table-cell>
			</fo:table-row>
		</fo:table-body>
	</fo:table>
</xsl:template>

<!-- =================================== -->
<!--	child element: Information       -->
<!-- =================================== -->
<xsl:template match="information">
	<fo:block font-size="7pt">
        <fo:table space-after="1cm" width="100%" table-layout="fixed">
		<fo:table-column column-width="20mm" />
        <fo:table-column column-width="20mm" />
        <fo:table-column column-width="25mm" />
        <fo:table-column column-width="15mm" />
        <fo:table-column column-width="30mm" />
        <fo:table-column column-width="25mm" />
		<fo:table-column column-width="20mm"/>
		<fo:table-column column-width="17mm"/>
		<fo:table-column column-width="23mm"/>
        <fo:table-body>
			<fo:table-row height="0.5cm" background-color="#DEE1E2">
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">Customer PO#</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center"><xsl:value-of select="/packingSlip/salesOrderFieldHeading"/></fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">PackingSlip Label</fo:block>
				</fo:table-cell>
  				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">Ship Date</fo:block>
				 </fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">Shipped Via</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">Way Bill</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">Del. Terms</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">#Cartons</fo:block>
				</fo:table-cell>
                <xsl:if test="showPackageInformation='true'">
                <fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">Net Weight(<xsl:value-of select="weightMeasurement"/>)</fo:block>
				</fo:table-cell>
                </xsl:if>
                <xsl:if test="showPackageInformation!='true'">
                <fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">Weight(<xsl:value-of select="weightMeasurement"/>)</fo:block>
				</fo:table-cell>
                </xsl:if>
            </fo:table-row>
			<fo:table-row  height="0.4cm" background-color="#FFFFEE">
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="customerPO"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="salesOrder"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="packingSlipLabel"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="actualShipDate"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="shippedVia"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center" hyphenate="true">
					<fo:block font-weight="bold" text-align="center">
						<fo:table width="95%" table-layout="fixed">
							<fo:table-column />
							<fo:table-body>
								<xsl:apply-templates/>
							</fo:table-body>
   						</fo:table>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="delTerms"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="cartons"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="right">
					<xsl:value-of select="weight"/>
					</fo:block>
				</fo:table-cell>
            </fo:table-row>
            </fo:table-body>
        </fo:table>
        </fo:block>
</xsl:template>

<!-- =================================== -->
<!--	child element: LineItems	   -->
<!-- =================================== -->
<xsl:template match="lineItems">
	<fo:block font-size="7pt">
        <fo:table width="100%" table-layout="fixed">
		<xsl:if test="skuPartTitle!=''">
            <fo:table-column column-width="10mm"/>
            <fo:table-column column-width="22mm"/>
                <fo:table-column column-width="22mm"/>
            <fo:table-column column-width="22mm"/>
            <fo:table-column column-width="22mm"/>
            <fo:table-column column-width="10mm"/>
            <fo:table-column column-width="13mm"/>
            <fo:table-column column-width="13mm"/>
            <fo:table-column column-width="12mm"/>
            <fo:table-column column-width="16mm"/>
            <fo:table-column column-width="41mm" />
        </xsl:if>
        <xsl:if test="skuPartTitle=''">
            <fo:table-column column-width="10mm"/>
            <fo:table-column column-width="25mm"/>
            <fo:table-column column-width="25mm"/>
            <fo:table-column column-width="25mm"/>
            <fo:table-column column-width="10mm"/>
            <fo:table-column column-width="15mm"/>
            <fo:table-column column-width="15mm"/>
            <fo:table-column column-width="12mm"/>
            <fo:table-column column-width="18mm"/>
            <fo:table-column column-width="41mm" />
        </xsl:if>
            <fo:table-body>
			<fo:table-row height="0.6cm" background-color="#DEE1E2">
				<fo:table-cell border="1pt double black" display-align="center" >
			    		<fo:block font-weight="bold" text-align="center">PO Line Item</fo:block>
	  			</fo:table-cell>
	  			<fo:table-cell border="1pt double black" display-align="center" >
		    			<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="mktPartTitle"/>
					</fo:block>
	  			</fo:table-cell>
                <xsl:if test="skuPartTitle!=''">
                    <fo:table-cell border="1pt double black" display-align="center" >
		    			<fo:block font-weight="bold" text-align="center">
					        <xsl:value-of select="skuPartTitle"/>
					    </fo:block>
	  			    </fo:table-cell>
                </xsl:if>
	  			<fo:table-cell border="1pt double black" display-align="center" >
		    			<fo:block font-weight="bold" text-align="center">Customer Part Number</fo:block>
	  			</fo:table-cell>
	  			<fo:table-cell border="1pt double black" display-align="center" >
		    			<fo:block font-weight="bold" text-align="center">Description</fo:block>
	  			</fo:table-cell>
	  			<fo:table-cell border="1pt double black" display-align="center" >
		    			<fo:block font-weight="bold" text-align="center">UOM</fo:block>
	  			</fo:table-cell>
	  			<fo:table-cell border="1pt double black" display-align="center" >
		    			<fo:block font-weight="bold" text-align="center"><xsl:value-of select="crdTitle"/><!--Customer Request Date--></fo:block>
	  			</fo:table-cell>
	  			<fo:table-cell border="1pt double black" display-align="center" >
					<fo:block font-weight="bold" text-align="center"><xsl:value-of select="schDateTitle"/><!--Schedule Date--></fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center" >
					<fo:block font-weight="bold" text-align="center">Req Qty</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">Qty Shipped</fo:block>
				</fo:table-cell>
	       		<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
						<fo:table width="100%"  table-layout="fixed">
                            <fo:table-column column-width="20mm" />
							<fo:table-column column-width="10mm"/>
                            <fo:table-column column-width="10mm"/>
							<fo:table-body>
                            <fo:table-row>
                                <fo:table-cell border="1pt double black" display-align="center" hyphenate="true" >
					                <fo:block font-weight="bold" text-align="center" >[ Lot # ]</fo:block>
				                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" hyphenate="true" >
					                <fo:block font-weight="bold" text-align="center">[Date Code]</fo:block>
				                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" hyphenate="true" >
                                    <fo:block font-weight="bold" text-align="center">[Qty]</fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            </fo:table-body>
   						</fo:table>
					</fo:block>
				</fo:table-cell>
			</fo:table-row>
			<xsl:for-each select="/packingSlip/lineItems/lineItem">
			<fo:table-row height="0.4cm" background-color="#FFFFEE">
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="poLineItem"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center" hyphenate="true" language = "en">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="mktPartNumber"/>
					</fo:block>
				</fo:table-cell>
                <xsl:if test="/packingSlip/lineItems/skuPartTitle!=''">
                    <fo:table-cell border="1pt double black" display-align="center" hyphenate="true" language = "en">
                        <fo:block font-weight="bold" text-align="center">
                            <fo:table width="80%" table-layout="fixed">
                                <fo:table-column width="75%" />
                                <fo:table-body>
                                    <xsl:apply-templates select="shippedSKUs"/>
                                </fo:table-body>
                            </fo:table>
                        </fo:block>
				    </fo:table-cell>
                </xsl:if>
				<fo:table-cell border="1pt double black" display-align="center" hyphenate="true" language = "en">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="CustomerPartNumber"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center" hyphenate="true" language = "en">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="description"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="units"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="requestDate"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="scheduleDate"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="reqQty"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell border="1pt double black" display-align="center">
					<fo:block font-weight="bold" text-align="center">
					<xsl:value-of select="qtyShipped"/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell width="100%" border="1pt double black" display-align="center" hyphenate="true">
					<fo:block font-weight="bold" font-size="8pt" text-align="center">
						<fo:table width="100%"  table-layout="fixed">
							<fo:table-column column-width="20mm" />
							<fo:table-column column-width="10mm"/>
                            <fo:table-column column-width="10mm"/>
							<fo:table-body>
								<xsl:apply-templates select="pulledLots/lot"/>
							</fo:table-body>
   						</fo:table>
					</fo:block>
				</fo:table-cell>
			</fo:table-row>
			</xsl:for-each>
		</fo:table-body>
	</fo:table>
	</fo:block>
</xsl:template>
<!-- =================================== -->
<!--	child element: Lot Vs Qty	 -->
<!-- =================================== -->
<xsl:template match="pulledLots/lot">
        <fo:table-row height="0.2cm">
            <fo:table-cell border="1pt double grey" >
                <fo:block text-align="left" >
                    <xsl:value-of select="lotName" />
                </fo:block>
            </fo:table-cell>
            <fo:table-cell border="1pt double grey" >
                <fo:block text-align="right" >
                    <xsl:value-of select="lotDateCode" />
                </fo:block>
            </fo:table-cell>
            <fo:table-cell border="1pt double grey" >
                <fo:block text-align="right" >
                    <xsl:value-of select="qty" />
                </fo:block>
            </fo:table-cell>
        </fo:table-row>
</xsl:template>
<!-- =================================== -->
<!--  Freight Tracking element: Tracking -->
<!-- =================================== -->
<xsl:template match="freightTracking">
	<fo:table-row>
		<fo:table-cell>
			<fo:block text-align="center" >
				<xsl:value-of select="tracking" />
			</fo:block>
		</fo:table-cell>
	</fo:table-row>
</xsl:template>

<xsl:template match="shippedSKUs">
    <fo:table-row>
        <fo:table-cell display-align="center">
            <fo:block>
                <xsl:value-of select="shippedSKU" />
            </fo:block>
        </fo:table-cell>
    </fo:table-row>
</xsl:template>
<!-- =================================== -->
<!--	END of Document		         -->
<!-- =================================== -->
</xsl:stylesheet>
